package com.yootk.listener;

import jakarta.servlet.ServletContextAttributeEvent;
import jakarta.servlet.ServletContextAttributeListener;
import jakarta.servlet.annotation.WebListener;

/**
 * Servlet上下文属性监听
 */
@WebListener
public class WebAttributeListener implements ServletContextAttributeListener {

    @Override
    public void attributeAdded(ServletContextAttributeEvent scae) {
        System.out.println("【WebAttributeListener.attributeAdded()】属性增加，属性名称：" + scae.getName() + "、属性内容：" + scae.getValue());
    }

    @Override
    public void attributeReplaced(ServletContextAttributeEvent scae) {
        System.out.println("【WebAttributeListener.attributeReplaced()】属性替换，属性名称：" + scae.getName() + "、属性内容：" + scae.getValue());
    }

    @Override
    public void attributeRemoved(ServletContextAttributeEvent scae) {
        System.out.println("【WebAttributeListener.attributeRemoved()】属性删除，属性名称：" + scae.getName() + "、属性内容：" + scae.getValue());
    }
}
